//第一层
var express = require('express');
var router = express.Router();
const {getUserAll2,serchUserAll2,getAllHireUsers,queryHireByName,queryHireByPhone,updateUserState} = require('../../service/user/userService')

//用户列表获取
router.get('/getUserAll', async function (req, res, next) {
    const data = await getUserAll2(req.query);
    res.send(data)
});

//用户列表搜索
router.get('/serchUserAll', async function (req, res, next) {
    const data = await serchUserAll2(req.query);
    res.send(data)
});

//获取所有hire用户
router.get('/getAllHireUsers', async function (req, res, next) {
    const data = await getAllHireUsers(req.query);
    res.send(data);
});
//名字查询
router.post('/queryHireByName', async function (req, res, next) {
    const data = await queryHireByName(req.body);    
    res.send(data);
});
//电话号码查询  
router.post('/queryHireByPhone', async function (req, res, next) {
    const data = await queryHireByPhone(req.body);    
    res.send(data);
});

//修改用户审核状态 
router.post('/updateUserState', async function (req, res, next) {
    const data = await updateUserState(req.body);    
    if(data.ok == 1){
        res.send(true);
    }
    res.send(false);
});

module.exports = router;

